﻿<controls:MetroWindow x:Class="SoftTeach.View.Noten.MetroStundennotenReminderWindow"
                      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                      xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
                      xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
                      xmlns:notenView="clr-namespace:SoftTeach.View.Noten"
                      xmlns:notenViewModel="clr-namespace:SoftTeach.ViewModel.Noten"
                      xmlns:controls="http://metro.mahapps.com/winfx/xaml/controls"
                      xmlns:termineViewModel="clr-namespace:SoftTeach.ViewModel.Termine"
                      xmlns:termineView="clr-namespace:SoftTeach.View.Termine"
                      xmlns:componentModel="clr-namespace:System.ComponentModel;assembly=WindowsBase"
                      mc:Ignorable="d" 
                      d:DesignHeight="768" 
                      d:DesignWidth="1366"
                      Title="Stundennoten"
                      FontSize="20" 
                      WindowState="Maximized" 
                      WindowButtonCommandsOverlayBehavior="Flyouts" 
                      Topmost="False" 
                      ShowTitleBar="True"  
                      ShowInTaskbar="True"
                      ShowIconOnTitleBar="False" 
                      ShowCloseButton="True" 
                      ScrollViewer.VerticalScrollBarVisibility="Disabled">
  <controls:MetroWindow.Resources>
    <ResourceDictionary>
      <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary Source="/SoftTeach;component/Resources/MetroResources.xaml"/>
        <ResourceDictionary >
          <DataTemplate DataType="{x:Type notenViewModel:SchülereintragViewModel}" x:Key="NotenTemplate">
            <notenView:MetroKlassenlisteNoteneintragDetailView />
          </DataTemplate>
          <DataTemplate DataType="{x:Type termineViewModel:StundeViewModel}" x:Key="StundenTemplate">
            <termineView:MetroStundeShortView />
          </DataTemplate>
          <CollectionViewSource x:Key="SortedSchülereinträge" Source="{Binding Path=CurrentSchülereinträge}">
            <CollectionViewSource.SortDescriptions>
              <componentModel:SortDescription PropertyName="SchülereintragSortByVornameProperty" Direction="Ascending" />
            </CollectionViewSource.SortDescriptions>
          </CollectionViewSource>
        </ResourceDictionary>
      </ResourceDictionary.MergedDictionaries>
    </ResourceDictionary>
  </controls:MetroWindow.Resources>
  <controls:MetroWindow.Flyouts>
    <controls:FlyoutsControl>
      <notenView:MetroNoteEintragenFlyout x:Name="NotenFlyout" DataContext="{Binding Path=CurrentSchülereintrag}"/>
    </controls:FlyoutsControl>
  </controls:MetroWindow.Flyouts>
  <Grid>
    <Grid.RowDefinitions>
      <RowDefinition Height="Auto"/>
      <RowDefinition Height="Auto"/>
      <RowDefinition Height="*"/>
    </Grid.RowDefinitions>
    <ListBox Grid.Row="0"
                 ItemsSource="{Binding Path=StundenView}"             
                 BorderThickness="0"
                 Name="StundenListBox"
                 ItemTemplate="{StaticResource StundenTemplate}"
             SelectedItem="{Binding Path=CurrentStunde}" SelectionChanged="StundenListBox_OnSelectionChanged"
             
             Height="100">
       <ListBox.ItemsPanel>
        <ItemsPanelTemplate>
          <StackPanel Orientation="Horizontal"/>
        </ItemsPanelTemplate>
      </ListBox.ItemsPanel>
      <ListBox.ItemContainerStyle >
        <Style TargetType="ListBoxItem">
          <Setter Property="Margin" Value="1"/>
          <Setter Property="Background" Value="LightGreen"/>
        </Style>
      </ListBox.ItemContainerStyle>
    </ListBox>
    <Border Grid.Row="1" Background="{StaticResource MetroHeaderBackground}">
      <Grid>
        <Grid.ColumnDefinitions>
          <ColumnDefinition Width="*"/>
          <ColumnDefinition Width="Auto"/>
          <ColumnDefinition Width="Auto"/>
          <ColumnDefinition Width="Auto"/>
        </Grid.ColumnDefinitions>
        <StackPanel Orientation="Horizontal" Grid.Column="0">
          <Label Foreground="White" Style="{StaticResource MetroLabelStyle}">Stundennoten für</Label>
          <Label Foreground="White" Style="{StaticResource MetroLabelStyle}" Content="{Binding Path=CurrentStunde.StundeStundenentwurfTitel}"/>
          <Label Foreground="White" Style="{StaticResource MetroLabelStyle}">vom</Label>
          <Label Foreground="White" Style="{StaticResource MetroLabelStyle}" Content="{Binding Path=CurrentStunde.StundeDatum}"/>
        </StackPanel>
        <Button Grid.Column="3" Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}" Command="{Binding Path=NoteneintragErledigtCommand}" ToolTip="Noteneintrag erledigt." Margin="5">
          <StackPanel Orientation="Horizontal">
            <Grid>
              <Image Source="/SoftTeach;component/Images/Erledigt48.png"/>
            </Grid>
          </StackPanel>
        </Button>
      </Grid>
    </Border>
    <ListBox Grid.Row="2"
             ItemsSource="{Binding Source={StaticResource SortedSchülereinträge}}"             
             BorderThickness="0"
             Name="NotenListBox"
             SelectedItem="{Binding Path=CurrentSchülereintrag}"
             SelectionChanged="NotenListBox_OnSelectionChanged"
             ItemTemplate="{StaticResource NotenTemplate}"
             >
      <!--ItemContainerStyle="{StaticResource UnselectableListBoxItem}">-->
      <ListBox.ItemsPanel>
        <ItemsPanelTemplate>
          <WrapPanel Height="{Binding ElementName=NotenListBox, Path=ActualHeight, Converter={StaticResource WrapPanelWidthConverter}}" Orientation="Vertical"/>
        </ItemsPanelTemplate>
      </ListBox.ItemsPanel>
      <ListBox.ItemContainerStyle >
        <Style TargetType="ListBoxItem">
          <Setter Property="Padding" Value="1"/>
        </Style>
      </ListBox.ItemContainerStyle>
    </ListBox>
  </Grid>
</controls:MetroWindow>
